`oat' is a program for testing the functionality of OpenGL on different platforms.
UNFORTUNATELY, we were unsuccessful in recompiling oat on IRIX 6.2.
However, pursuing our goal of extending collaboration between the DTjanitor and everyone in the Developer Program, although we were not able to port/successfully recompile this source to/on IRIX 6.2, we still include all files so that, if any one of you has the saavy, and finds the inclination/motivation enabling you to succeed in reviving oat, PLEEZE send us whatever files (source, Makefile, etc.) you modify to "make it go" again, and we will add these back into the v6.2 DT release as resuscitated src+binaries.
It provides a GUI interface to test most (hopefully all) the different attributes that are changeable in OpenGL.
run it as:
oat [<filemame>]
where <filename> is an Inventor .iv data file. In the iv subdir you'll find some test files, like cone.iv, sphere.iv, tri.iv (triangle), plane.iv (a quad), etc.Also, the /usr/demos/data/yaodl/*.ydl files have been converted into .iv format and you can find them in /hosts/mistral.esd/usr/people/kyriazis/oat/bin/iv, if you are internal to SGI.
This program uses the Inventor interaction paradigm, so if you are unfamiliar with it, go learn it! :-) Actually, play around with ivview to get accustomed to it.
This program is not meant to be an Inventor file viewer, but a tester for OpenGL attributes, etc., so all attributes that your .iv file contains are being stripped out, hopefully in a graceful manner. Also, some Inventor primitives are not supported, because I had to alter them to get rid of any interaction that Inventor has with OpenGL. Namely, the only primitives that are supported are: Cone, Cylinder, Sphere, Cube, FaceSet and IndexedFaceSet.
In addition, when oat starts up it uses the initial OpenGL defaults, which are not necesserily visually pleasing: No lighting, no shading, everything is a dull white. But, again, oat is supposed to test OpenGL, so it starts up by setting no OpenGL attributes whatsoever.
Command-Line Options -------------------- They go before the filename. Current ones are: -ci Start up in a Color Index visual. -sb Start up in a single-buffer mode (instead of double buffer if that exists). -nr Disable quick interaction. By default, everything you change (through the GUI) triggers a redraw. This frag disables this behavior, so you can change multiple parameters at the same time, and then redraw the scene manually. -fps Print (to stdout) frames per second after each frame. It is calculated as "1/seconds-per-frame". -h Displays a help screen. User Interface: --------------- There are several menus and popup panels that are available. We will go through them as they appear in the menubar. FILE: Open: Open an .iv file Quit: Quit oat Manips: Selects an Inventor SoTransformManip to be used when using the pointer (from the panel on the right). POPUPS: These are the popup panels that allow you to alter OpenGL attribute. Classification was done more-or-less according to "The OpenGL Machine" poster. VIEW: Setup ortho or perspective view. VISUALS: Choose an X visual to be used.. The menu contains a list of all the visuals of the X server that support OpenGL rendering, in other words, all the visuals that that you can use in the current graphics hardware.One thing which is a bit non-obvious is that for one-line text item, you let the program know you are done by pressing your average Return key. For multi-line text items, you use the ENTER key at the far right of the keyboard.. (It was a Motif-ism... If you find an easy way to solve this problem, change TextItem.* and MatrixItem.*).There is also a column of buttons on the right of the drawing area. These buttons are almost identical to the buttons existing in SceneViewer. Here is a brief description:
Arrow/Hand: Pick/Move toggles.
House: Go Home
House w/ arrow: Set Home position.
Weird eye: Alter the view so that the BBox of the scene fits in view.
Target: Smooth motion to picked point.
PIXMAP: Create a pixmap using current visual, draw in it, dump it in an RGB file, and then display that file using ipaste.
IMPLEMENTATION:This program was written using C++, Inventor, and ViewKit. I attempted to structure code as much as possible, so it should be relatively easy to alter or add functionality. Look at src/Makefile for a brief classification of the source files in the src directory.
GlWindow is the main "dispatcher" class that figures out what to do with each user event. Unfortunately, it's a pretty monilithic class, and I haven't bothered myself with finding an easy way of splitting it up. If you find an easy way, please let me know.
There is one class for each of the user-interface panels that show up. The user interface is created automatically in an algorithmic manner. That's why the layout my look a bit stupid. The superclass (IfaceGenerator) of the interface classes provides the parser that reads in the description of the window and creates the Motif widgets. There is a wrapper around each one of the OpenGL functions in order to provide an easy way to provide feedback debugging information. Additionally, each user interface class has a local mirror of the part of the OpenGL state that it alters, so that it can keep OpenGL in sync with the user interface when visuals are changed, etc.
Inventor is used for primitive description and database traversal. Since Inventor does a lot of attribute binding behind our backs, I copied the most significant parts of the GLRender routines of certain SoShapes and made local copies of those primitives that do not alter the state. In this way, Oat has full control of the OpenGL state. Instances of the those local classes are created when an Inventor file is read in. After an Inventor file is being loaded in, it is being traversed to check if it contains any shape nodes that are not "converted", or any attribute nodes. Such nodes are then erased from the tree.
This program uses X application default files. By default "make install" puts the defaults file (called Oat) into $ROOT/usr/lib/X11/app-defaults. You should make arrangements of being able to have that directory in your XAPPLRESDIR or XUSERFILESEARCHPATH, otherwise your user interface may pop up in that ugly default Motif blue color with the very ugly buttons.
Also, for your convenience, the parent directory has a file called stipple-patts. This contains sample stipple patterns to be used with the polygon stipple text item. In order to use one of them, empty out the polygon stipple text area, 'cat' the stipple-pats file in a separate window, highlight the pattern you want (with the left mouse button), and paste it in the stipple text area (with the middle button). Don't forget to confirm your selection with ENTER (not Return; this is a multi-line text item).USER-DEFINED PRIMITIVES:I have made a subclass of Inventor's SoShape node, which allows the person who plays around with 'oat', to add his own OpenGL code in the GlUserDef1 class and test some obscure OpenGL case, that way.
You can make a .iv file that contains an instance of UserDef1, and load the file as you would normally.
If you'd like to play around with that file, look in GlUserDef1.* for code that has been #ifdef'ed out like:
#ifdef FILL_HERE
..
..
#endif
It should be more or less obvious...
If you have any questions, please send mail to kyriazis@sgi.comGeorge Kyriazis kyriazis@sgi.com